{% extends "survey/base.html" %}
{% load i18n %}
{% block content %}{% load survey %}
<h1>{% trans "Surveys"%}</h1>
<fieldset class="module">
<table style="width: 100%">
    <thead><th>{% trans "Survey"%}</th><th>{% trans "Status"%}</th><th>{% trans "Info"%}</th></thead>
    {% for survey in object_list %}
    {% if survey.open or user|can_view_answers:survey %}
    <tr class="{% cycle row1,row2 %}">
        <td>{% if survey.open and not request|has_answered:survey %}<a href='{% url survey-detail survey_slug=survey.slug %}'>{{ survey.title }}</a>
            {% else %}{{ survey.title }}{% endif %}</td>
        <td>{{ survey.status }}</td>
        <td>
        {% if user|can_view_answers:survey %}
            {% if survey.interview_count %}
                <a href='{% url survey-results survey_slug=survey.slug %}'>{{ survey.interview_count }} Submission{{ survey.interview_count|pluralize:"s" }}</a>
            {% else %}
                {% trans "No Submissions."%}
            {% endif %}
        {% endif %}
        {% if request|has_answered:survey %}{% trans "You have"%} <a href='{% url answers-detail survey_slug=survey.slug,key=request.session.session_key %}'>{% trans "completed"%}</a> {% trans "this survey."%}{% endif %}
        </td></tr>
    {% endif %}
    {% endfor %}
</table>
</fieldset>
{% endblock %}
